package com.yuantu.judiciary.model.word;

import java.io.FileInputStream;
import java.io.InputStream;
import java.net.URL;

/**
 * @author kgwei
 */
public class LoadImage {

    public static InputStream loadImageStreamWithUrl(String imageUrl) {
        try {
            return new URL(imageUrl).openStream();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    public static InputStream loadImageStreamWithPath(String path) {
        try {
            return new FileInputStream(path);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    public static InputStream loadImageStreamWithResources(String path) {
        try {
            return LoadImage.class.getResourceAsStream("/" + path);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

}
